package service

import (
	"gin_cli/pkg/cache"
	"gin_cli/pkg/wechat"
)

func GetWechatAccessToken() string {
	accessToken, err := cache.Get("access_token")
	if err != nil {
		accessToken, err = wechat.WechatSDK.GetAccessToken()
		if err != nil {
			panic(err)
		}
		cache.Set("access_token", accessToken, 7190)
	}
	return accessToken
}

func GetWechatUserInfo(openid string) {
	accessToken := GetWechatAccessToken()
	wechat.WechatSDK.GetUserInfo(openid, accessToken)

}
